var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && d == 0) {
        im.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            im.dispose();
            var e = im.getItemId();
            im.sendNormalTalk("礼物已经发放了, 请按照道具仔细确认有效期后再行使用. ", 0, 9010000, false, false);
            im.gainItem(2433509, 1);
            im.gainItem(2433510, 1);
            im.gainItem(1004404, 1);
            im.gainItem(1102799, 1);
            im.gainItem(1052893, 1);
            im.gainItem(2439170, 8);
            im.gainItem(e, -1)
        }
    }
};